<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第九课 生命周期钩子函数</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <div>{{num}}</div>
        <div class="div1"></div>  
        <button @click="showNumFn">按钮</button>  
    </div>
    <script>
        new Vue({
            el:'#app',
            data:{
                num:100
            },
            beforeCreate:function(){
                console.log('beforeCreate');
                // this.showNumFn();
            },
            created:function(){
                console.log('created');
                // console.log(this);
                // console.log(this.num);
                // this.showNumFn();
            },
            beforeMount:function(){
                console.log('beforeMount');
            },
            mounted:function(){
                this.$nextTick(function(){
                    console.log('mounted');
                });
            },
            beforeUpdate:function(){
                console.log('beforeUpdate');
            },
            updated:function(){
                console.log('updated');
            },
            activated:function(){
                console.log('activated');
            },
            deactivated:function(){
                console.log('deactivated');
            },
            beforeDestroy:function(){
                console.log('beforeDestroy');
            },
            destroyed:function(){
                console.log('destroyed');
            },
            methods: {
                showNumFn(){
                    this.num = 600;
                    // console.log(this.num + 500);
                }
            },
        })
    </script>
</body>
</html>